home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- proc int server(string $dName, string $sName)
- {
- //defineDataServer -d $dName -s $sName;
- return initDataServer($dName,$sName,"localhost", "", "",2);
- }
-
- proc attach1D( string $device, string $channel, float $scale,
- string $target, string $attribute)
- {
- string $axisName;
- $axisName = $channel;
- string $atrName = $target+"."+$attribute;
-
- attachDeviceAttr -d $device -ax $axisName $atrName;
- setAttrMapping -a -d $device -ax $axisName -at $attribute -s $scale;
- }
-
- proc string makeCylinder()
- {
- string $sarr[] = `cylinder -ax 0 1 0`;
- return $sarr[0];
- }
-
- proc attachHands(string $device, string $hands[] )
- {
- attach1D($device, "seconds", 1.0, $hands[0], "rz");
- attach1D($device, "minutes", 1.0, $hands[1], "rz");
- attach1D($device, "hours", 1.0, $hands[2], "rz");
- }
-
- proc makeHands( string $dName, string $hands[] )
- {
- // Second hand
- //
- $hands[0] = makeCylinder();
- scale -a .1 6 .1 $hands[0];
- $rp = $hands[0]+".rotatePivot";
- select -r $rp;
- move -r 0 -6 0;
- select -r $hands[0];
- move -r 0 6 0;
- select;
-
- // Minute hand
- //
- $hands[1] = makeCylinder();
- scale -a .25 6 .25 $hands[1];
- $rp = $hands[1]+".rotatePivot";
- select -r $rp;
- move -r 0 -6 0;
- select -r $hands[1];
- move -r 0 6 0;
- select;
-
- // Hour hand
- //
- $hands[2] = makeCylinder();
- scale -a .5 4 .5 $hands[2];
- $rp = $hands[2]+".rotatePivot";
- select -r $rp;
- move -r 0 -4 0;
- select -r $hands[2];
- move -r 0 4 0;
- select;
-
- attachHands($dName, $hands);
- }
-
- proc makeFace()
- {
- select;
- textCurves -s 8 -n "three" 3;
- select "three";
- move -a 9.8615 -2.62462 0;
-
- select;
- textCurves -s 8 -n "six" 6;
- select "six";
- move -a -2 -14.348 0;
-
- select;
- textCurves -s 8 -n "nine" 9;
- select "nine";
- move -a -13.6563 -2.5 0;
-
- select;
- textCurves -s 8 -n "twelve" 12;
- select "twelve";
- move -a -4.30736 9 0;
-
- select;
- sphere;
-
- select -tgl;
- }
-
- global proc string mayaClockDemo()
- {
- if (!`licenseCheck -m "edit" -typ "complete"`) {
- error("You are not licensed to use the \"mayaClockDemo\" MEL proc.");
- }
-
- string $dName="clock";
- string $sName="mayaClockServer";
-
- if ( 0 != server($dName, $sName) ) {
- error("Couldn't launch " + $sName );
- return "";
- }
-
- string $hands[3];
-
- makeHands($dName, $hands);
- rename $hands[0] second_hand;
- rename $hands[1] minute_hand;
- rename $hands[2] hour_hand;
-
- //makeFace();
- return $sName;
- }
-
-